package com.own.business.system.user.business.service;

import com.own.business.system.user.entity.bo.SystemUserSecurityBo;
import com.own.business.system.user.entity.map.SystemUserSecurityMapVo;
import com.own.business.system.user.entity.po.SystemUser;
import com.own.business.system.user.entity.po.SystemUserSecurity;
import com.own.business.system.user.entity.query.SystemUserSecurityQuery;
import com.own.business.system.user.entity.vo.SystemUserSecurityVo;
import com.own.component.common.base.service.BaseService;

import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;

/**
 * SystemUserSecurityService
 *
 * @author chenxueli
 * @date 2021/06/25 16:51:09
 */
public interface SystemUserSecurityService extends BaseService<
        SystemUserSecurity,
        SystemUserSecurityBo,
        SystemUserSecurityVo,
        SystemUserSecurityMapVo,
        SystemUserSecurityQuery
        > {

    /**
     * 验证账号的安全信息
     *
     * @param user    登录的用户信息
     * @param fun     登录信息
     * @param loginIp 登录的ip
     * @param account 登录的账号
     */
    void checkPasswordSecurity(SystemUser user, Consumer<SystemUserSecurityVo> fun, String loginIp, String account);

    /**
     * 根据用户id修改信息
     *
     * @param userId 用户id
     * @param type   修改类型
     * @return 是否修改成功
     */
    boolean modifyByUserId(Long userId, String type);

    /**
     * 修改账号安全信息
     *
     * @param userId      用户id
     * @param getFunction 获取修改字段的方法
     * @param setFunction 设置修改字段的方法
     * @return 是否修改成功
     */
    boolean modify(Long userId, Function<SystemUserSecurity, Integer> getFunction, BiConsumer<SystemUserSecurity, Integer> setFunction);

}
